package com.ruoyi.apis.vo;

import com.ruoyi.apis.entity.LogoEntity;
import com.ruoyi.apis.utils.ResponseUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author Choi
 * @Date 2021/8/23
 */

@Getter
@Setter
public class LogoVO {
    @Id
    private Long id;
    private String name;
    private String icon;
    private String discription;
    private Date createTime;
    private Date updateTime;

    public LogoVO(LogoEntity logoEntity) {
        BeanUtils.copyProperties(logoEntity, this);
        this.setIcon(ResponseUtils.getFulImage(logoEntity.getIcon()));
    }

    public static List<LogoVO> getLogos(List<LogoEntity> logos) {
        return logos.stream()
                .map(LogoVO::new)
                .collect(Collectors.toList());
    }

}
